home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1986 September
/
Ahoy_Magazine_86-09_1986_Double_L.d64
/
Large Product
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
422b
|
19 lines
0 poke 53280,15:poke53281,15:print"please wait..."
1 rem commodares problem #29-4:
2 rem large product
3 rem solution by
4 rem bob brown
5 rem
110 forj=1to4:p(j)=j:next:gosub3000
200 fork=4to1step-1:ifp(k)<5+kthengosub2000:goto200
220 next
1000 printb,val(c$),val(d$):stop
2000 p(k)=p(k)+1:ifk=4 then 3000
2010 forl=k+1toj:p(l)=p(l-1)+1:next
3000 a$="":b$="":c=1:forl=1to9
3020 ifp(c)=lthena$=a$+str$(10-l):c=c+1:goto3050
3030 b$=b$+str$(10-l)
3050 next
3100 p=val(a$)*val(b$):ifp>bthenb=p:c$=a$:d$=b$
3200 return